﻿using Newtonsoft.Json.Linq;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

/// <summary>
/// 安排课程时使用的课表数据。
/// 仅在课表安排器中作为中间结构使用，其本质上为经过验证的用户输入的课表数据。
/// </summary>
namespace HFUTCourseSimulation.Kernel.Data.Built {

    public class Semester {
        public DateTime startDate;
        public int weekCount, indexCount;
        public int breakfastAt, lunchAt, dinnerAt;
        public List<Course> courses;
    }

    public class Course {
        public string name, description;
        public Util.ColorPair color;
        public List<Schedule> schedules;
    }

    public class Schedule {
        public IEnumerable<int> week;
        public IEnumerable<int> day;
        public IEnumerable<int> index;
    }

    public class IndividualInt : IEnumerable<int> {
        public IndividualInt(IEnumerable<int> it) {
            _values = it.ToList();
        }

        private List<int> _values;

        public IEnumerator<int> GetEnumerator() {
            return _values.GetEnumerator();
        }
        IEnumerator IEnumerable.GetEnumerator() {
            return GetEnumerator();
        }
    }

    public class RangedInt : IEnumerable<int> {
        public RangedInt(int start, int end) {
            this._start = start;
            this._end = end;
        }

        private int _start, _end;

        public IEnumerator<int> GetEnumerator() {
            return Enumerable.Range(_start, _end - _start + 1).GetEnumerator();
        }
        IEnumerator IEnumerable.GetEnumerator() {
            return GetEnumerator();
        }
    }

}
